< previous page page_238 next page >

Page 238
available to loan. It might be tempted to put all the data into one table. However, when the data required for each type of record is listed, you can see that certain pieces of information aren't common for both items. In creating one table, many of the entries would be blank for the books, and there would be some blank ones for the videos as well. You also would have to add a column to distinguish between a video and a book. Creating the database this way would result in a lot of wasted space and could also result in poorer application performance. Figure 9.1 shows database table with the two types of information combined, whereas Figure 9.2 shows the same information separated into two tables.
12181-0238a.gif
Figure 9.1.
Combining information into one table can waste space.
12181-0238b.gif
Figure 9.2.
Dividing information into separate tables provides each table with
only the relevant data.
As you can see, when the data is separated into two tables, the amount of wasted space is reduced to almost nothing. When deciding what data should be in which tables, the main thing to remember is that, if the information would result in wasted space for many of the rows in the table, the data doesn't belong there.
What's Normal?
Normalizing a database is the process used to reduce or eliminate any repetitive data that might be in the database. The process of normalization involves three steps. Each step

 
< previous page page_238 next page >

If you like this book, buy it!